<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>

<script language="JavaScript" type="text/javascript" src="../javascript/caltimer.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/ajaxdeal.js"></script>
<html:form action="register/registeraction">
<input type="hidden" name="steptype" value="4"/>
<div id="regright">
  
   <table width="650" border="0" cellpadding="0" cellspacing="0">
          <tr class="th_bj">
            <td width="200" height="28" align="center"> <span class="f-12-b-ffffff">选择</span></td>
            <td width="350" height="28" align="center"  ><span class="f-12-b-ffffff">分类名称</span></td>
            <td>&nbsp;</td>
          </tr>
   </table>
	<table width="650" border="0" cellpadding="0" cellspacing="0" id="fileuploadtable">
	           <logic:iterate id="supagent" name="prodCateList">
	           <tr>
	            <td width="200" align="center" ><input name="selCate" type="checkbox" 
	            	<logic:equal value="1" name="supagent" property="zdy2">
								checked
					</logic:equal>/></td>
	            <td width="450" height="35" align="center">
	            	<input name='pk_da_prod_cate' type="hidden"  value="${supagent.pk_da_prod_cate }"/>
	            	<input align="center" name='cate_name' type='text' value="${supagent.cate_name }" readonly="readonly" style="border:1px;border-bottom-style:none;border-top-style:none;border-left-style:none;border-right-style:none;"/>
	            </td>
	          </tr>
	          </logic:iterate>
	</table>
  <table>
  	<tr>
  		<td colspan="4" class="f-12-F60000" align="center"><input type="button" onclick="calbackoper()" value="确定"/></td>
  	</tr>
  	<tr>
    	<td colspan="4" class="f-12-F60000">说明：带“*”的为必填信息，带“<span class="f-12-000000">▼</span>”为可下拉选取的框，置灰框为不可修改信息</td>
    </tr>
  </table>
</div>
</html:form>

<script language="javascript">
	var calBackValues = "";
	var calBackPks = "";
	window.onload = function()
	{
		//获取父窗体已选中的分类的内容
		var conent = window.dialogArguments.document.getElementsByName('tgcplb')[0].value;
		var conents = conent.split(",");
		var cate_name = document.getElementsByName("cate_name");
		var selCate = document.getElementsByName("selCate");
		for(var index = 0; index < cate_name.length; index++){
			for(var i = 0; i < conents.length; i++){
				if(cate_name[index].value == conents[i]){
					selCate[index].checked = true;
					continue;
				}
			}
		}
	}
	window.onbeforeunload = function()  
	{  
		if(calBackValues==""){
			window.returnValue="";
		}else{
			window.returnValue=calBackValues.substring(0,calBackValues.length-1)+";"+calBackPks.substring(0,calBackPks.length-1);
		}
		window.close();
	}
	function calbackoper(){
		var pk_da_prod_cate = document.getElementsByName("pk_da_prod_cate");
		var cate_name = document.getElementsByName("cate_name");
		var selCate = document.getElementsByName("selCate");
		calBackValues = "";
		calBackPks = "";
		for(var index = 0; index < pk_da_prod_cate.length; index++){
			if(selCate[index].checked){
					//alert("第"+(index+1)+"被选中了"+cate_name[index].value);
					calBackValues = calBackValues + cate_name[index].value+",";
					calBackPks = calBackPks + pk_da_prod_cate[index].value+",";
			}
		}
		window.onbeforeunload();
	}
</script>